﻿<style>
    
    #layuiadmin-app-form-list .layui-table-cell {
        height:28px !important;
    }
    #layuiadmin-app-form-list layui-table-header {
        height:28px !important;
    }
</style>
<div class="layui-form" lay-filter="layuiadmin-app-form-list" id="layuiadmin-app-form-list"
    style="padding: 20px -10px 0 0;">

    <fieldset class="layui-elem-field layui-field-title">
        <legend>发货信息</legend>
    </fieldset>
    <script type='text/html' template lay-done='layui.data.formdone(d.params);'>
        <input type='hidden' name='PID' value="{{ d.params.PID || '' }}"/>
    </script>
    <div class='layui-form-item'>
        <label class='layui-form-label'>订单号</label>
        <div class='layui-input-inline'>
            <script type='text/html' template>
                <input type='text' name='OrderID_SelSourceName' value='{{ d.params.OrderID_SelSourceName || '' }}' readonly='readonly' id='OrderID_SelSourceName' class='layui-input' />
            </script>
        </div>

        <label class='layui-form-label'>发货单号</label>
        <div class='layui-input-inline'>
            <script type='text/html' template>
                <input type='text' readonly='readonly' name='DeliveyNumber' value='{{ d.params.DeliveyNumber || '' }}' autocomplete='off' class='layui-input' />
            </script>
        </div>

    </div>
    <div class='layui-form-item'>
        <label class='layui-form-label'>下单人</label>
        <div class='layui-input-inline'>
            <script type='text/html' template>
                <input type='text' readonly='readonly' name='User_SelSourceName' value='{{ d.params.User_SelSourceName || '' }}' autocomplete='off' class='layui-input' />
            </script>
        </div>
        <label class='layui-form-label'>会员编号</label>
        <div class='layui-input-inline'>
            <script type='text/html' template>
                <input type='text' readonly='readonly' name='MemberCode' value='{{ d.params.MemberCode || '' }}' autocomplete='off' class='layui-input' />
            </script>
        </div>
    </div>

    <div class='layui-form-item'>
        <label class='layui-form-label'>联系人</label>
        <div class='layui-input-inline'>
            <script type='text/html' template>
                <input type='text' readonly='readonly' name='UserName' value='{{ d.params.UserName || '' }}' lay-verify='required' placeholder='联系电话' autocomplete='off' class='layui-input'>
            </script>
        </div>
        <label class='layui-form-label'>联系电话</label>
        <div class='layui-input-inline'>
            <script type='text/html' template>
                <input type='text' readonly='readonly' name='UserTel' value='{{ d.params.UserTel || '' }}' lay-verify='required' placeholder='联系电话' autocomplete='off' class='layui-input'>
            </script>
        </div>

        <label class='layui-form-label'>联系地址</label>
        <div class='layui-input-inline' style="width:320px">
            <script type='text/html' template>
                <input type='text' readonly='readonly' name='UserAddress' value='{{ d.params.UserAddress || '' }}' lay-verify='required' placeholder='联系地址' autocomplete='off' class='layui-input'>
            </script>
        </div>
    </div>
    <div class='layui-form-item'>
        <label class='layui-form-label'>订单金额</label>
        <div class='layui-input-inline'>
            <script type='text/html' template>
                <input type='text' readonly='readonly' name='OrderPrice' value='{{ d.params.OrderPrice || '' }}' lay-verify='required' placeholder='订单金额' autocomplete='off' class='layui-input'>
            </script>
        </div>
        <label class='layui-form-label'>订单配送方式</label>
        <div class='layui-input-inline'>
            <script type='text/html' template>
                <input type='text' readonly='readonly' name='DistributionMode' id='DistributionMode' autocomplete='off' class='layui-input'>
            </script>
        </div>
        <label class='layui-form-label'>订单备注</label>
        <div class='layui-input-inline' style="width:320px">
            <script type='text/html' template>
                <input type='text' readonly='readonly' name='RMK' value='{{ d.params.RMK || '' }}' lay-verify='required' placeholder='订单备注' autocomplete='off' class='layui-input'>
            </script>
        </div>
    </div>

    <div class='layui-form-item'>
        <label class='layui-form-label'>发货人</label>
        <div class='layui-input-inline'>
            <script type='text/html' template>
                <input type='text' readonly='readonly' name='SendUser_SelSourceName' value='{{ d.params.SendUser_SelSourceName || '' }}' lay-verify='required' placeholder='发货人' autocomplete='off' class='layui-input'>
            </script>
        </div>
        <label class='layui-form-label'>发货时间</label>
        <div class='layui-input-inline'>
            <script type='text/html' template>
                <input type='text' readonly='readonly' name='DeliverTime' id='DeliverTime' value='{{ d.params.DeliverTime || '' }}' lay-verify='datetime' placeholder='yyyy-MM-dd HH:mm:ss' autocomplete='off' class='layui-input'>
            </script>
        </div>
        <label class='layui-form-label'>发货类型</label>
        <div class='layui-input-inline'>
            <script type='text/html' template>
                <input type='text' readonly='readonly' id="DeliverType" name='DeliverType' lay-verify='required' placeholder='' autocomplete='off' class='layui-input'>
            </script>
        </div>
    </div>

    <div class='layui-form-item'>
        <label class='layui-form-label'>快递单号</label>
        <div class='layui-input-inline'>
            <script type='text/html' template>
                    <input type='text' readonly='readonly' id="ExpressNumber" name='ExpressNumber' value='{{ d.params.ExpressNumber || '' }}' lay-verify='required' placeholder='快递单号' autocomplete='off' class='layui-input'>
                </script>
        </div>
        <label class='layui-form-label'>快递公司</label>
        <div class='layui-input-inline'>
            <script type='text/html' template>
                    <input type='text' readonly='readonly' id="ExpressName" name='ExpressName' value='{{ d.params.ExpressName || '' }}' lay-verify='required' placeholder='快递公司' autocomplete='off' class='layui-input'>
                </script>
        </div>
        <label class='layui-form-label'>快递公司编码</label>
        <div class='layui-input-inline'>
            <script type='text/html' template>
                    <input type='text' readonly='readonly' id="ExpressCode" name='ExpressCode' value='{{ d.params.ExpressCode || '' }}' lay-verify='required' placeholder='快递公司编码' autocomplete='off' class='layui-input'>
                </script>
        </div>
    </div>
    <fieldset class="layui-elem-field layui-field-title">
        <legend>发货商品</legend>
    </fieldset>
    <div class="layui-form-item">
        <script type='text/html' template lay-done='layui.data.getTable(d.params);'>
            <table id="LAY-app-content-listDeliver" lay-filter="LAY-app-content-listDeliver"></table>
        </script>
    </div>
</div>

<script type="text/javascript">
    
    layui.data.formdone = function (d) {
        var form = layui.form;
        var $ = layui.$;

        if (d.DeliverType == 0) {
            $("#DeliverType").val("邮寄发货");
        } else if (d.DeliverType == 1) {
            $("#DeliverType").val("自提发货");
        } else if (d.DeliverType == 2) {
            $("#DeliverType").val("核销发货");
        } else {
            $("#DeliverType").val("其他发货");
        }
        if (d.DistributionMode == 1) {
            $("#DistributionMode").val("快递");
        } else {
            $("#DistributionMode").val("自提");
        }
        if (d.DeliverType != 0) {
            $("#ExpressNumber").val("");
            $("#ExpressName").val("");
            $("#ExpressCode").val("");
        }
    }

    layui.data.getTable = function (d) {
        var form = layui.form;
        var table = layui.table;
        var $ = layui.$;

        var colsdata = [[
            //{ type: 'checkbox', fixed: 'left', field: 'PID' }, //sort: true  //hide: true //  width:100
            //{ field: 'OrderPID_SelSource', title: '订单ID' },
            //{ field: 'OrderPID_SelSourceName', title: '订单' },
            //{ field: 'DeliverPID_SelSource', title: '发货单' },
            //{ field: 'DeliverPID_SelSourceName', title: '发货单' },
            //{ field: 'GoodsPID_SelSource', title: '商品PID' },
            //{ field: 'GoodsPID_SelSourceName', title: '商品' },
            //{ field: 'Brand', title: '品牌' },
            { field: 'Name', title: '商品名称' },
            { field: 'Specifications', title: '规格' },
            { field: 'Price', title: '商品价格' },
            { field: 'Count', title: '商品数量' },
            { field: 'AllPrice', title: '总价' },
            { field: 'RMK', title: '备注' },
            //{ field: 'Path_Upload', title: '商品图片' },
        ]];

        table.render({
            elem: "#LAY-app-content-listDeliver"
            , toolbar: false  //开启工具栏，此处显示默认图标，可以自定义模板，详见文档
            , method: "post"
            , url: layui.setter.APIUrl + '/shop/order_DeliverGoodsMgr/listPain?limit=100'
            , where: { PID: d.PID }
            , headers: { //通过 request 头传递
                Authorization: "bearer " + layui.data('layuiAdmin').access_token
            }
            , parseData: function (res) { //res 即为原始返回的数据 
                varButtonRight = res.Data.ButtonRight;
                return {
                    "ResultCode": res.ResultCode, //解析接口状态
                    "ResultInfo": res.ResultInfo, //解析提示文本
                    "count": res.Data.TotalRecordCount, //解析数据长度
                    "Data": res.Data.Items //解析数据列表 
                };
            }
            , cols: colsdata
            , page: false
            , text: {
                none: '暂无相关数据' //默认：无数据。注：该属性为 layui 2.2.5 开始新增 text: '对不起，加载出现异常！'
            }
        });
    }

    layui.use(['form', 'table'], function () {
        var form = layui.form;//required（必填项）phone（手机号）email（邮箱）url（网址）number（数字）date（日期）identity（身份证） 自定义值
        var table = layui.table;
        var $ = layui.$;

    });
</script>